import type { Dayjs } from 'dayjs';

import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace BaseinfoChathistoryApi {
  /** 回话记录信息 */
  export interface BaseinfoChathistory {
    id: number; // 序号
    chatId: number; // 回话ID
    chatName: string; // 回话话题
    chatDescription: string; // 回话描述
    tempFile: string; // 模板文件
    demaToProd: boolean; // 发起方
    messageType: number; // 紧急程度
    messageBody: string; // 消息内筒
    sendTime?: Dayjs | string; // 发送时间
    flag?: boolean; // 1新增2更新3删除
  }
}

/** 查询回话记录分页 */
export function getBaseinfoChathistoryPage(params: PageParam) {
  return requestClient.get<PageResult<BaseinfoChathistoryApi.BaseinfoChathistory>>('/csyt/baseinfo-chathistory/page', { params });
}

/** 查询回话记录详情 */
export function getBaseinfoChathistory(id: number) {
  return requestClient.get<BaseinfoChathistoryApi.BaseinfoChathistory>(`/csyt/baseinfo-chathistory/get?id=${id}`);
}

/** 新增回话记录 */
export function createBaseinfoChathistory(data: BaseinfoChathistoryApi.BaseinfoChathistory) {
  return requestClient.post('/csyt/baseinfo-chathistory/create', data);
}

/** 修改回话记录 */
export function updateBaseinfoChathistory(data: BaseinfoChathistoryApi.BaseinfoChathistory) {
  return requestClient.put('/csyt/baseinfo-chathistory/update', data);
}

/** 删除回话记录 */
export function deleteBaseinfoChathistory(id: number) {
  return requestClient.delete(`/csyt/baseinfo-chathistory/delete?id=${id}`);
}

/** 批量删除回话记录 */
export function deleteBaseinfoChathistoryList(ids: number[]) {
  return requestClient.delete(`/csyt/baseinfo-chathistory/delete-list?ids=${ids.join(',')}`)
}

/** 导出回话记录 */
export function exportBaseinfoChathistory(params: any) {
  return requestClient.download('/csyt/baseinfo-chathistory/export-excel', params);
}


